<?php
use \blog\model\Article;
use \blog\model\Meta;
use \blog\libs\Html;
use \blog\libs\Common;
?>
<!DOCTYPE html>
<html>
<head>
	<title><?=$title?></title>
	<?php $this->display('common/header'); ?>
	<?=Html::link()?>
</head>
<body>
<div class="mdl-layout mdl-layout--fixed-drawer">
	<?php $this->display('common/navbar') ?>
	<main class="mdl-layout__content">
		<div class="page-content article-list">
		<?php
		$list = Article::getList(['body' => TRUE, 'limit' => '0,' . Common::option('pagesize')]);
		while ($a = $list->next()) {
		?>
			<article class="mdl-card mdl-shadow--2dp">
				<div class="mdl-card__title mdl-card--expand">
					<h2 class="mdl-card__title-text"><a href="<?php $a->url(); ?>"><?php $a->title(); ?></a></h2>
				</div>
				<div class="mdl-card__supporting-text"><?php $a->excerpt(180, '...'); ?></div>
				<div class="mdl-card__actions mdl-card--border">
					<span class="date"><?php $a->date('Y-m-d H:i'); ?></span>
					<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect" href="<?php $a->url(); ?>">查看全文</a>
				</div>
			</article>
		<?php } ?>
		<nav class="page-list mdl-cell mdl-cell--12-col">
			<?php
			$list->setPage(1); //首页是第一页
			$list->pageNav('span', '', 'active', '<i class="material-icons" role="presentation">arrow_back</i>', '<i class="material-icons" role="presentation">arrow_forward</i>', 'mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon');
			?>
		</nav>
	</main>
</div>
<?php $this->display('common/footer'); ?>
</body>
</html>